<%@page  language="java" import="java.util.*" %>
<%@ page import="java.sql.*"%>
<%@ page import="blog1.DBBean"%>
<%@ page import="blog1.UserBean"%>
<%@ page contentType="text/html;charset=utf-8"%>     
<%@ page pageEncoding="utf-8" %>
<%@ page import="java.util.Date"%>
<%@ page import="java.text.SimpleDateFormat"%>

<jsp:useBean id="myDBbean" class="blog1.DBBean"></jsp:useBean>

<jsp:useBean id="user" class="blog1.UserBean" scope="request"></jsp:useBean>
<jsp:setProperty name="user" property="*" />

<%

	request.setCharacterEncoding("utf-8");
    //解决数据库插入的乱码问题
    String info  = new String(request.getParameter("passageoutline").getBytes("ISO-8859-1"),"utf-8");
    String info1  = new String(request.getParameter("passage").getBytes("ISO-8859-1"),"utf-8");
    //去除由textarea产生的<p>以及最后的<br>
    String info2=info1.substring(3,info1.length()-8);
  	//String info =request.getParameter("passageoutline");
  	//String info1 = request.getParameter("passage");
    response.setContentType("text/html;charset=utf-8");
    Date d = new Date();
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd ");//设置日期格式
    SimpleDateFormat df1 = new SimpleDateFormat("HH:mm:ss ");//设置日期格式
    String date=df.format(new Date());
    String time=df1.format(new Date());
	String good="34";
	String sql="INSERT INTO article(userId,articleName,articleContent,articleGood,articleDate,articleTime) VALUES("+"1"+",'"+info+"','"+info2+"','"+good+"','"+date+"','"+time+"'"+");";
	myDBbean.update(sql);
	out.println(sql);
	response.sendRedirect("article.jsp");	
%>


